package service.impl;

import dao.UserDao;
import dao.impl.UserDaoImpl;
import factory.ObjectFactory;
import service.UserService;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/5/16 10:29
 * Version:1.0-SNAPSHOT
 * Description:
 */
public class UserServiceImpl implements UserService {

//    private UserDao userDao = new UserDaoImpl();
//    private UserDao userDao = (UserDao) ObjectFactory.getObject();
    private UserDao userDao;
    private String name;

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void login() {
        System.out.println("name:"+name);
        userDao.select();
    }

    @Override
    public void register() {
        System.out.println("name:"+name);
        userDao.insert();
    }
}
